﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Data.SQLite;

namespace LiteData
{
    public class LogFile
    {
        static string file = "c:\\types.txt";

        public void Write2(string aText)
        {
            string conStr = @"Data Source=F:\Documents and Settings\pablofoniko\Escritorio\prueba.sql.sqlite;Version=3;";
            string sql = "SELECT * FROM table_values";
            //string sql = "SELECT * FROM vvv";
            
            using (SQLiteConnection oConnection = new SQLiteConnection(conStr))
            {
               oConnection.Open();
                SQLiteDataReader oSQLiteDataReader;            
                using (SQLiteCommand oCommand = new SQLiteCommand(sql))
                {
                    oCommand.Connection = oConnection;                    
                    oSQLiteDataReader = oCommand.ExecuteReader();
                    for(int i = 0; i < oSQLiteDataReader.FieldCount; i++)
                    {
                        
                            StreamWriter sw = new StreamWriter(file, true);
                            sw.Write(oSQLiteDataReader[i].GetType().ToString());
                            sw.Write(" // ");
                            sw.Write(oSQLiteDataReader.GetFieldType(i)+" ");
                            sw.WriteLine(oSQLiteDataReader.GetDataTypeName(i));                            
                            sw.Close();
                        
                    }
                }
                oConnection.Close();
            }                        
        }
    }
}
